#include <iostream>
#include <vector>
using namespace std;

int method(vector<int> &values, int n, int m)
{
        if(m == 0){
                return 1;
        }

        if(n == 0){
                return 0;
        }

        int mth = method(values, n - 1, m);
        if(values[n] <= m){
                mth += method(values, n, m - values[n]);
        }
        return mth;
}

long long method(vector<int> &values, int n, int m, vector<vector<long long>> &recd)
{
        if(m == 0){
                return 1;
        }

        if(n == 0){
                return 0;
        }

        if(recd[n][m] != -1){
                return recd[n][m];
        }

        long long mth = method(values, n - 1, m, recd);
        if(values[n] <= m){
                mth += method(values, n, m - values[n], recd);
        }
        return recd[n][m] = mth;
}

long method_dp(vector<int> &values, int n, int m)
{
        vector<vector<long>> dp(n + 1, vector<long>(m + 1, 0));
        for(int i = 0; i <= n; i++){
                dp[i][0] = 1;
        }

        for(int i = 1; i <= n; i++){
                for(int j = 1; j<=m; j++){
                        dp[i][j] = dp[i - 1][j];
                        if(values[i] <= j){
                                dp[i][j] += dp[i][j - values[i]];
                        }
                }
        }
        return dp.back().back();
}

long method_dp_sp(vector<int> values, int n, int m)
{
        vector<long> dp(m + 1, 0);
        dp[0] = 1;

        for(int i = 1; i <= n; i++){
                for(int j = values[i]; j <= m; j++){
                        dp[j] += dp[j - values[i]];
                }
        }
        return dp.back();
}



int main()
{
        int n, m;
        cin>>n>>m;

        vector<int> value(n + 1, 0);
        for(int i = 1; i <= n; i++){
                cin>>value[i];
        }

        vector<vector<long long>> recd(n + 1, vector<long long>(m + 1, -1));
        //cout<<method(value, n, m, recd)<<endl;
        cout<<method_dp_sp(value, n, m)<<endl;
        return 0;
}